<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" th:with="title='申报资讯',active='news'">
<header th:replace="admin/header::headerFragment(${title},${active})"></header>
<body class="fixed-left">
<div id="wrapper">
    <div th:replace="admin/header::header-body"></div>
    <div class="content-page">
        <div class="content">
            <div class="container">
                <div class="row">
                    <div class="col-sm-12">
                        <h4 class="page-title">申报资讯</h4>
                    </div>
                    <div class="col-md-12">
                        <div class="row">
                            <form method="post" action="/admin/news/search">
                                <div class="form-group col-md-3" style="padding: 0 10px 0 0;">
                                    <input id="title" name="title" class="form-control" placeholder="请输入标题" />
                                </div>
                                <div class="form-group col-md-3" style="padding: 0 10px 0 0;">
                                    <select id="applyStatus" name="applyStatus" class="form-control">
                                        <option value=""> - 请选择申报状态 - </option>
                                        <option value="APPLYING">开放申报中</option>
                                        <option value="END">申报已结束</option>
                                    </select>
                                </div>

                                <div class="form-group col-md-3" style="padding: 0 10px 0 0;">
                                    <select id="projectLevel" name="projectLevel" class="form-control">
                                        <option value=""> - 请选择项目级别 - </option>
                                        <option value="部委">部委</option>
                                        <option value="省级">省级</option>
                                        <option value="市级">市级</option>
                                        <option value="区级">区级</option>
                                    </select>
                                </div>

                                <div class="form-group col-md-3" style="padding: 0 10px 0 0;">
                                    <select id="fundAmount" name="fundAmount" class="form-control">
                                        <option value=""> - 请选择资助力度 - </option>
                                        <option value="50万以下">50万以下</option>
                                        <option value="50-100万">50-100万</option>
                                        <option value="100-500万">100-500万</option>
                                        <option value="500万以上">500万以上</option>
                                    </select>
                                </div>

                                <div class="form-group col-md-3" style="padding: 0 10px 0 0;">
                                    <select id="fundType" name="fundType" class="form-control">
                                        <option value=""> - 请选择资助类型 - </option>
                                        <option value="人才计划">人才计划</option>
                                        <option value="技术创新">技术创新</option>
                                        <option value="技术改造">技术改造</option>
                                        <option value="高技术产业化">高技术产业化</option>
                                        <option value="企业管理提升">企业管理提升</option>
                                        <option value="市场拓展">市场拓展</option>
                                        <option value="品牌培育">品牌培育</option>
                                        <option value="税费优惠">税费优惠</option>
                                        <option value="资质认定">资质认定</option>
                                        <option value="文化创意">文化创意</option>
                                        <option value="其他方向">其他方向</option>
                                    </select>
                                </div>

                                <div class="form-group col-md-3" style="padding: 0 10px 0 0;">
                                    <select id="fundMode" name="fundMode" class="form-control">
                                        <option value=""> - 请选择资助方式 - </option>
                                        <option value="资金">资金</option>
                                        <option value="政策">政策</option>
                                        <option value="资金+政策">资金+政策</option>
                                    </select>
                                </div>

                                <div class="form-group col-md-2">
                                    <button type="submit" class="btn btn-success waves-effect waves-light m-b-5"><i class="fa fa-search"></i>查询</button>
                                    <button type="reset" class="btn btn-warning waves-effect waves-light m-b-5"><i class="fa fa-trash"></i>清空</button>
                                </div>
                            </form>
                        </div>

                        <div class="pull-right">
                            <a th:href="@{/admin/news/add}" class="btn btn-success waves-effect waves-light m-b-5">
                                <i class="fa fa-edit"></i>
                                <span>新增</span>
                            </a>
                        </div>

                        <table class="table table-striped table-bordered">
                            <thead>
                            <tr>
                                <th width="15%">标题</th>
                                <th width="5%">项目级别</th>
                                <th width="6%">资助力度</th>
                                <th width="8%">资助类型</th>
                                <th width="5%">资助方式</th>
                                <th width="15%">组织部门</th>
                                <th width="8%">申报开始日期</th>
                                <th width="8%">申报结束日期</th>
                                <th width="8%">发布日期</th>
                                <th width="6%">申报状态</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <th:block th:each="row : ${news.list}">
                                <tr th:id="${row.id}">
                                    <td th:text="${row.title}"></td>
                                    <td th:text="${row.projectLevel}"></td>
                                    <td th:text="${row.fundAmount}"></td>
                                    <td th:text="${row.fundType}"></td>
                                    <td th:text="${row.fundMode}"></td>
                                    <td th:text="${row.orgDept}"></td>
                                    <td th:text="${row.applyStartDate} ? ${#dates.format(row.applyStartDate,'yyyy-MM-dd')}"></td>
                                    <td th:text="${row.applyEndDate} ? ${#dates.format(row.applyEndDate,'yyyy-MM-dd')}"></td>
                                    <td th:text="${row.publishDate} ? ${#dates.format(row.publishDate,'yyyy-MM-dd')}"></td>
                                    <td>
                                        <th:block th:if="${row.applyStatus == 'APPLYING'}">
                                            <span class="label label-success">申报中</span>
                                        </th:block>
                                        <th:block th:if="${row.applyStatus == 'END'}">
                                            <span class="label label-danger">已结束</span>
                                        </th:block>
                                    </td>
                                    <td>
                                        <a th:href="@{'/admin/news/edit/'+${row.id}}" class="btn btn-primary btn-sm waves-effect waves-light m-b-5">
                                            <i class="fa fa-edit"></i> <span>编辑</span>
                                        </a>
                                        <a href="javascript:void(0)" th:onclick="'del('+${row.id}+');'" class="btn btn-danger btn-sm waves-effect waves-light m-b-5">
                                            <i class="fa fa-trash-o"></i> <span>删除</span>
                                        </a>
                                        <a class="btn btn-warning btn-sm waves-effect waves-light m-b-5"
                                           th:href="@{'/application/information/'+${row.id}}" target="_blank">
                                            <i class="fa fa-eye"></i> <span>预览</span></a>
                                    </td>
                                </tr>
                            </th:block>
                            </tbody>
                        </table>
                        <div th:replace="comm/paginator :: pageAdminNav(${news}, '/admin/news/list')"></div>
                    </div>
                </div>
                <div th:replace="admin/footer :: footer-content"></div>
            </div>
        </div>
    </div>
</div>
<div th:replace="admin/footer :: footer"></div>
<script type="text/javascript">
    /*<![CDATA[*/
    var tale = new $.tale();

    function del(id) {
        tale.alertConfirm({
            title: '确定删除这条新闻吗?',
            // showCancelButton : true,
            // type : 'question',
            then: function () {
                $.ajax({
                    url: '/admin/news/del/' + id,
                    dataType: 'json',
                    success: function (result) {
                        if (result && result.success) {
                            tale.alertOkAndReload('删除成功');
                        } else {
                            tale.alertError(result.msg || '删除失败');
                        }
                    }
                });
            }
        });
    }

    /*]]>*/
</script>
</body>
</html>